/*
 * @Descripttion:
 * @version:
 * @Author: fei
 * @Date: 2024-11-11 10:20:23
 * @LastEditors: fei
 * @LastEditTime: 2024-12-02 17:21:27
 */
import React, { Suspense, useEffect } from "react";
import "./App.css";
import {
  RouterProvider,
} from "react-router-dom";
import router from "@/route/index.tsx";

// // 上面的结果是一个对象，相当于
// const modules ={
//     "./views/daily/index.vue": () => import("/src/views/daily/index.vue")
// }
// //路由守卫
// function PrivateRoute({ children, isLoggedIn }) {
//   return isLoggedIn ? children : <Navigate to="/login" replace />;
// }
import { setRouter } from "@/store/routerModulesSlice";
import { useAppDispatch } from "@/store/hooks"
const App: React.FC = () => {
  const despatch = useAppDispatch();
  useEffect(() => {
    const modules = import.meta.glob([
      "./pages/*.tsx",
      "./pages/*/*.tsx",
      "./pages/*/*/*.tsx",
    ]);
    console.log(modules)
    despatch(setRouter(modules));
  }, []);
  return (
      
      <Suspense>
        <RouterProvider router={router} />
      </Suspense>
  );
};

export default App;
